home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor2 / loop.doc < prev    next >
Text File  |  1995-03-31  |  2KB  |  28 lines

  1. (Comp.sys.hp48) 
  2. Item: 1703 by stevev@miser.uoregon.edu [Steve VanDevender] 
  3. Date: 14 Sep 1992 
  4.  
  5. There are a couple of subtleties to the structure of a WHILE-REPEAT-END 
  6. clause.  Between WHILE and REPEAT, you can put any sequence of objects without 
  7. having to bind them into a single program object.  However, between the REPEAT 
  8. and the END, there must be only one object--if you specify multiple objects, 
  9. the user RPL compiler compiles them into a single program object.  If there is 
  10. nothing between the REPEAT and the END, a null program is inserted, because 
  11. there must be at least one object to traverse if the REPEAT condition fails. 
  12. If you specify only one object, then it does not have to be surrounded with 
  13. DOCOL and SEMI, providing a significant savings in space and execution time. 
  14.  
  15. Those of you who have read _HP 48 Insights, Vol. I_ may already know this. 
  16. [See page 327. -jkh-] In any conditional where a sequence of objects could be 
  17. skipped if a test fails, then the sequence is combined into a single program 
  18. object which can be traversed using the program object traversal method. 
  19. Therefore you get a 5-byte savings if only one object can be placed between 
  20. THEN-END, THEN-ELSE, ELSE-END, or REPEAT-END (and probably some others; I 
  21. don't have the book handy right now).  Those of you who have dabbled in system 
  22. RPL have also encountered this; the low-level system RPL looping and branching 
  23. constructs expect single objects in conditionals but system RPL compilers 
  24. won't enforce the rule, so you have to be conscious of when a multi-object 
  25. conditional needs to be surrounded by DOCOL and SEMI. 
  26.  
  27. -- Steve VanDevender       stevev@greylady.uoregon.edu 
  28.